<template>
    <div>
        <van-list v-model:loading="loading" :finished="true" finished-text="没有更多了">
            <template v-for="item in LogList">
                <van-row class="box" @click="gotoStudy(item.fileid)">
                    <van-col span="18" class="left_box">
                        <van-col span="24" class="left_cont">
                            {{ item.filename }}
                        </van-col>
                        <van-col span="24" class="left_cont_desc">
                            {{ item.remark }}
                        </van-col>
                        <van-col span="24" class="left_cont_summary">
                            <template v-if="item.num > 0">
                                学习次数:{{ item.num }} &nbsp; &nbsp;上次阅读时间:{{ item.lasttime }}
                            </template>
                            <template v-else>
                                该视频未进行学习
                            </template>
                        </van-col>
                    </van-col>
                    <van-col span="6" class="right_box">
                        <van-col span="24" v-if="item.num > 0" class="right_cont">
                            <van-tag color="#f1f36c" text-color="#939a2b" size="large">再次学习</van-tag>
                        </van-col>
                        <van-col span="24" v-else class="right_cont">
                            <van-tag color="#a1f3cd" text-color="#2bb743" size="large">去学习</van-tag>
                        </van-col>
                    </van-col>
                </van-row>
                <van-divider />
            </template>


        </van-list>
    </div>
</template>

<script>
import store from "@/store/index";
export default {
    name: 'name',
    data() {
        return {
            LogList: [],
            loading: true,
            codetype: '0'
        }
    },
    created() {
        this.LoadStudyLog()
        if (this.$route.query.codetype != undefined) {
            if (!isNaN(parseInt(this.$route.query.codetype))) {
                if(this.$route.query.codetype==3){
                    this.codetype = 3
                }else{
                    this.codetype = parseInt(this.$route.query.codetype) > 0 ? 1 : 0
                }
                
            }
        }
    },
    methods: {
        LoadStudyLog() {
            var _codetype=null
        // if(this.codetype==3){
        //     _codetype=3
        // }
        if(this.$route.query.codetype==3){
            _codetype=3
        }
            let params = { mobile: this.$route.query.mobile ,IndustryType:_codetype};
            let self = this
            this.$axios.get('/UserStudyTime/GetWatchLog', { params: params }).then((res) => {
                self.LogList = res.data.data;
                self.loading = false
                console.log('self.LogList', self.LogList)
            });
        },
        gotoStudy(id) {
            this.$router.push({ path: "/qtyjReport/StudyFirst", query: { fileid: id, codetype: this.codetype } })
        }
    },

}
</script>

<style scoped>
.box {
    background-color: #fff;
}

.left_box,
.right_box {
    height: 70px;
    line-height: 70px;
}

.left_cont,
.left_cont_desc,
.left_cont_summary {
    height: 23px;
    line-height: 23px;
    padding: 2px;
    padding-left: 10px;
    font-size: 12px;
}

.left_cont {
    font-weight: bold;
}

.left_cont_desc {
    color: darkgray;
}

.left_cont_summary {
    color: #868282;
}

.right_cont {
    text-align: center;
    font-size: 13px;
    font-weight: bold;
}</style>